/// @tags: Tarjan
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
using std::make_pair;
using std::max;
using std::min;
using std::pair;
using std::swap;

namespace BlueQuantum {

int const N = 5e5 + 5, mod = 1e6 + 7;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Edge {
  int v, nxt;
};

struct Graph {
  Edge e[N << 1];

  int e_cnt, heads[N];

  Graph() : e_cnt(1) {}

  inline void add(int u, int v) {
    e[++e_cnt].v = v, e[e_cnt].nxt = heads[u], heads[u] = e_cnt;
  }

} G, H, I;

int n, m, cid, cnt, top;
int dfn[N], deg[N], low[N], cc[N], f[N], num[N];

bool vis[N], bdg[N << 1];
pair<int, int> ans[N];

namespace Hash {

int cnt, heads[mod + 5];

struct HashEdge : Edge {
  int u, x, y, z;
} e[N];

inline void add(int v, int z, int x, int y) {
  int u = 1ll * v * z % mod;
  e[++cnt].v = v, e[cnt].z = z, e[cnt].x = x, e[cnt].y = y, e[cnt].nxt = heads[u],
  heads[u] = cnt;
}

inline pair<int, int> query(int v, int z) {
  int u = 1ll * v * z % mod;
  for (int i = heads[u]; i; i = e[i].nxt)
    if (e[i].v == v && e[i].z == z) return make_pair(e[i].x, e[i].y);
  return make_pair(0, 0);
}

}  // namespace Hash

void tarjan(int u, int fa) {
  dfn[u] = low[u] = ++cnt;
  for (int i = G.heads[u], v; i; i = G.e[i].nxt) {
    if ((v = G.e[i].v) != fa) {
      if (!dfn[v]) {
        tarjan(v, u);
        low[u] = min(low[u], low[v]);
        if (dfn[u] < low[v]) bdg[i] = bdg[i ^ 1] = true;
      } else
        low[u] = min(low[u], dfn[v]);
    }
  }
}

void getCC(int u) {
  cc[u] = cid;
  for (int i = G.heads[u]; i; i = G.e[i].nxt)
    if (!bdg[i]) {
      num[cid]++;
      if (!cc[G.e[i].v]) getCC(G.e[i].v);
    }
}

int dfs2(int u, int fa) {
  if (num[u]) return u;
  for (int i = H.heads[u]; i; i = H.e[i].nxt) {
    if (H.e[i].v == fa) continue;
    int res = dfs2(H.e[i].v, u);
    if (res) return res;
  }
  return 0;
}

void dfs3(int u, int fa) {
  vis[u] = true;
  if (num[u]) f[u] = true;
  for (int i = H.heads[u], v; i; i = H.e[i].nxt)
    if (!vis[v = H.e[i].v]) {
      dfs3(v, u);
      f[u] |= f[v];
    }
  if (!f[u]) return;
  for (int i = H.heads[u], v; i; i = H.e[i].nxt)
    if ((v = H.e[i].v) != fa) {
      if (!f[v]) ans[++top] = make_pair(u, v);
    }
}

void dfs4(int u, int fa) {
  vis[u] = true;
  for (int i = H.heads[u], v; i; i = H.e[i].nxt)
    if ((v = H.e[i].v) != fa) {
      deg[u]++;
      dfs4(v, u);
      if (!deg[v]) ans[++top] = make_pair(v, u);
    }
}

inline int main() {
  read(n), read(m);
  for (int i = 1, u, v; i <= m; ++i) {
    read(u), read(v);
    G.add(u, v), G.add(v, u);
    I.e[i].nxt = u, I.e[i].v = v;
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i, 0);
  for (int i = 1; i <= n; ++i)
    if (!cc[i]) cid++, getCC(i);
  for (int i = 1, u, v; i <= m; ++i) {
    u = I.e[i].nxt, v = I.e[i].v;
    if (cc[u] != cc[v]) {
      H.add(cc[u], cc[v]), H.add(cc[v], cc[u]);
      if (cc[u] < cc[v]) Hash::add(cc[u], cc[v], u, v);
      else
        Hash::add(cc[v], cc[u], v, u);
    }
  }
  for (int i = 1, u; i <= cid; ++i)
    if (!vis[i]) {
      u = dfs2(i, 0);
      if (u) dfs3(u, 0);
      else {
        dfs4(i, 0);
        if (deg[i] == 1) ans[++top] = make_pair(i, H.e[H.heads[i]].v);
      }
    }
  printf("%d\n", top);
  for (int i = 1, u, v; i <= top; ++i) {
    bool flag = false;
    u = ans[i].first, v = ans[i].second;
    if (u > v) swap(u, v), flag = true;
    ans[i] = Hash::query(u, v);
    if (flag) swap(ans[i].first, ans[i].second);
  }
  std::sort(ans + 1, ans + top + 1);
  for (int i = 1; i <= top; ++i) printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("deadend.in", "r", stdin);
  freopen("deadend.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}